package cn.com.bluemoon.daps.system.controller.api;

import cn.com.bluemoon.daps.api.sys.RemoteSysOperateLogService;
import cn.com.bluemoon.daps.common.constant.ServiceNameConstants;
import cn.com.bluemoon.daps.common.datascope.IgnorePermission;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.system.controller.DapOperateLogController;
import cn.com.bluemoon.daps.system.dto.OperateLogPageDTO;
import cn.com.bluemoon.daps.system.entity.DapOperateLog;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description 操作日志api接口
 * @Author luolq
 * @Date 2022/2/28 10:54
 * @Vsersion 1.0
 **/
@Api(tags = {"FeignClient服务-操作日志api接口"})
@RequestMapping(ServiceNameConstants.DapsApiSystem.API_SYS_LOG)
@RestController
@Slf4j
@IgnorePermission(name = "服务注册-操作日志api接口")
public class DapOperateLogApi implements RemoteSysOperateLogService {
    @Resource
    private DapOperateLogController dapOperateLogController;

    @PostMapping(value = "/page")
    @ApiOperation(value = "分页获取操作日志信息")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "ok", response = ResultBean.class)})
    public ResultBean<IPage<DapOperateLog>> operateLogPage(OperateLogPageDTO dto) {
        return dapOperateLogController.operateLogPage(dto);
    }

    @PostMapping(value = "/addOperateLog")
    @ApiOperation(value = "新增操作日志")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "ok", response = ResultBean.class)})
    @IgnorePermission(name = "新增操作日志")
    public ResultBean<Boolean> addOperateLog(DapOperateLog operateLog) {
        return dapOperateLogController.addOperateLog(operateLog);
    }
}
